//
//  TitleXQViewController.m
//  geiTA
//
//  Created by duyan on 14-11-20.
//  Copyright (c) 2014年 lanou3g.com 蓝鸥科技. All rights reserved.
//




#import "TitleXQViewController.h"

@interface TitleXQViewController ()<UIWebViewDelegate>

@end

@implementation TitleXQViewController
- (void)dealloc
{
    [_str release];
    [super dealloc];
}
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
//  [self.navigationController setNavigationBarHidden:NO animated:YES];
    self.navigationController.navigationBar.translucent = YES;
    self.navigationController.navigationBar.barStyle = UIBarStyleBlack;
   [self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"navigation_bar_background.png"] forBarMetrics:UIBarMetricsCompactPrompt];
    [self.navigationController.navigationBar setBackgroundColor:[UIColor clearColor]];
    
    self.navigationController.tabBarController.tabBar.hidden = YES;
    
     [self creatWbview];
    [self creatTool];
    [self creatbutton];
}



-(void)changurl:(NSString *)str
{
    self.str = str;
}
-(void)creatWbview
{
    UIWebView *web = [[UIWebView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
    NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:self.str]];
    [self.view addSubview:web];
    [web loadRequest:request];
    web.delegate = self;
    [web release];
}

-(void)creatbutton
{
    UIButton *button = [[UIButton alloc]initWithFrame:CGRectMake(0, 0, 44, 44)];
    [button setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [button setTitle:@"返回" forState:UIControlStateNormal];
    [button addTarget:self action:@selector(buttonAction:) forControlEvents:UIControlEventTouchUpInside];
   [self.view addSubview:button];
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithCustomView:button];
 
    [button release];
  
}
-(void)buttonAction :(id)sender
{
    [self.navigationController popViewControllerAnimated:YES];
}



- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error
{
    NSLog(@"%@", error);
}

-(void)creatTool
{
    UIButton *butt2 = [[UIButton alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width / 3.5, 40)];
    [butt2 setBackgroundColor:[UIColor yellowColor]];
    [butt2 setImage:[UIImage imageNamed:@"down.png"] forState:UIControlStateNormal];
    UIBarButtonItem *Item  = [[UIBarButtonItem alloc]initWithCustomView:butt2];
    
  
    
    //添加第一个图标按钮
    
    UIButton *butt = [[UIButton alloc]initWithFrame:CGRectMake(0, self.view.frame.size.width, self.view.frame.size.width / 3.5, 40)];
    [butt setBackgroundColor:[UIColor redColor]];
    [butt setImage:[UIImage imageNamed:@"up.png"] forState:UIControlStateNormal];
    UIBarButtonItem *Item1  = [[UIBarButtonItem alloc]initWithCustomView:butt];
    
    //添加第二个图标按钮
    
  
    UIButton *butt1 = [[UIButton alloc]initWithFrame:CGRectMake(0, self.view.frame.size.width * 2, self.view.frame.size.width / 3.5, 40)];
    [butt1 setBackgroundColor:[UIColor purpleColor]];
    [butt1 setImage:[UIImage imageNamed:@"zou.png"] forState:UIControlStateNormal];
    UIBarButtonItem *Item2  = [[UIBarButtonItem alloc]initWithCustomView:butt1];
    
    UIToolbar *toolBar = [[UIToolbar alloc]init];
    [toolBar setFrame:CGRectMake(0, self.view.frame.size.height - 44, self.view.frame.size.width, 40)];
    toolBar.barStyle = UIBarStyleBlackOpaque ;
    toolBar.items = [NSArray arrayWithObjects:Item,  Item1,  Item2, nil];
    toolBar.tintColor = self.navigationController.navigationBar.tintColor;
 

    toolBar.autoresizingMask = UIViewAutoresizingFlexibleWidth;
    
    

    
    [toolBar sizeToFit];
    [self.view addSubview:toolBar];

}

-(void)button
{
    NSLog(@"+-+++++++");
}

-(void)viewWillAppear:(BOOL)animated
{
 
// UIToolbar *tool = [[UIToolbar alloc]init];
//    [tool setFrame:CGRectMake(0, self.view.frame.size.height - 40, self.view.frame.size.width, 40)];
//    [tool setBackgroundColor:[UIColor grayColor]];
//
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
